using System;
using System.Data;
using System.Collections;

using EntLibEC.Info.Basic;
using EntLibEC.Dac.Basic;
using EntLibEC.Biz;
using EntLibEC.Dac;
using EntLibEC.Cmn;

namespace EntLibEC.Biz.Basic
{
	/// <summary>
	/// Summary description for ProductNotShowTop10Manager.
	/// </summary>
	public class ProductNotShowTop10Manager
	{
		private ProductNotShowTop10Manager()
		{
			
		}
		private static ProductNotShowTop10Manager _instance;

		public static ProductNotShowTop10Manager GetInstance()
		{
			if ( _instance == null )
			{
				_instance = new ProductNotShowTop10Manager();
			}
			return _instance;
		}

		public void insert(ProductNotShowTop10Info oParam)
		{
		    new ProductNotShowTop10Dac().Insert(oParam);
		}

		public void delete(int sysno)
		{
		    new ProductNotShowTop10Dac().Delete(sysno);
		}

		public DataSet GetNotShowTop10List(Hashtable ht)
		{
		    string sql = @"select Ent_Product_NotShowTop10.SysNo as SysNo , Ent_Product.ProductID , Ent_Product.ProductName ,
                                  Ent_Sys_User.UserName , Ent_Product_NotShowTop10.CreateTime
                           from   Ent_Product_NotShowTop10
                           inner join Ent_Product on Ent_Product_NotShowTop10.ProductSysNo = Ent_Product.sysno               
                           
                           inner join Ent_Sys_User on Ent_Product_NotShowTop10.CreateUserSysNo = Ent_Sys_User.SysNo
                           where 1=1                                 
                                 @ProductSysNo
                           Order By Ent_Product_NotShowTop10.CreateTime desc ";
			

			if (ht.ContainsKey("ProductSysNo"))
				sql = sql.Replace("@ProductSysNo" , " and Ent_Product_NotShowTop10.ProductSysNo =" + ht["ProductSysNo"].ToString());
			else
				sql = sql.Replace("@ProductSysNo" , "");

			return SqlHelper.ExecuteDataSet(sql);
		
		}

		public bool isHasItem(int productsysno)
		{
		    string sql = "select * from Ent_Product_NotShowTop10 where productsysno = " + productsysno ;
			
			DataSet ds = SqlHelper.ExecuteDataSet(sql);

			if (Util.HasMoreRow(ds))
				return true;
			else
				return false;
					
		}
	}
}
